<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>

<div id="app">

    {{message}}

    <br/>
    <span v-bind:title="message">
        鼠标悬停几秒钟查看此处的提示信息！
    </span>

    <h1 v-if="ok">yes</h1>
    <h1 v-else>no</h1>

    <li v-for="(item, index) in items">
        {{ item.message }} -- {{ index }}
    </li>

    <button v-on:click="reverseMessage">反转</button>

    <br/>
    输入框
    <input type="text" v-model="inputData">
    {{inputData}}

    <br/>
    下拉框
    <select v-model="selectData">
        <option disabled value="">请选择</option>
        <option value="a">A</option>
        <option value="b">B</option>
        <option value="c">C</option>
    </select>
    {{selectData}}

    <my-component></my-component>

</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script>
    Vue.component('my-component', {
        template: '<div>A custom component!</div>'
    })

    var vm = new Vue({
        el: "#app",
        data: {
            message: "hello vue!",
            ok: true,
            items: [
                {message: 'Foo'},
                {message: 'Bar'},
                {message: 'Baz'}
            ],
            inputData: "",
            selectData: ""
        },
        methods: {
            reverseMessage: function () {
                this.message = this.message.split('').reverse().join('')
            }
        }
    })
</script>

</body>

</html>